package pri.damai.xiaowu.goods.server.manager;

//import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
//import org.springframework.amqp.core.Message;
//import org.springframework.amqp.rabbit.annotation.RabbitHandler;
//import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

/**
 *
 * @Desc
 * @Author yxf
 * @Date 2022/4/6 21:39
 * 但行好事，莫问前程。
 */
@Slf4j
@Component
public class RabbitManager {
//
//    @RabbitHandler
//    @RabbitListener(queues = "common_queue")
//    public void process(Message message, Channel channel) {
//        long deliveryTag = message.getMessageProperties().getDeliveryTag();
//        String msg = new String(message.getBody());
//        try {
////            if (Objects.equals("\"test_fail\"",msg)) {
////                throw new RuntimeException();
////            }
//            channel.basicAck(deliveryTag,false);
//            log.info("【MQ 消费者】{} 处理消息成功:{}。{}", LocalDateTime.now(),msg,deliveryTag);
//        } catch (Exception e) {
//            try {
//                channel.basicNack(deliveryTag,false,true);
//                log.info("【MQ 消费者】{} 处理消息失败:{}。{}", LocalDateTime.now(),msg,deliveryTag);
//            } catch (Exception ioException) {
//                log.info("【MQ 消费者】{} 通知消息处理未成功失败:{}。{}", LocalDateTime.now(),msg,deliveryTag);
//            }
//        }
//
//    }
}
